﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPrincipal.master" AutoEventWireup="true" CodeFile="NovoAcesso.aspx.cs" Inherits="NovoAcesso" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 <link href="scripts/tiny_mce/themes/simple/skins/default/ui.css" rel="stylesheet"
        type="text/css" />
    <script src="scripts/jquery-1.6.1.min.js" type="text/javascript"></script>
    <script src="scripts/fswgrid-0.2.js" type="text/javascript"></script>
    <script src="scripts/json2.js" type="text/javascript"></script>
    <script src="scripts/jquery.blockUI.js" type="text/javascript"></script>
    <script src="scripts/MascaraValidacao.js" type="text/javascript"></script>
    <link href="Css/geral.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    if($('#textNome').val() != "" && $('#textLogin').val() != "" && $('#textSexo').val() != "" && $('#textSenha').val() != "" && $('#textEmail').val() != "")
    {
        function cadastrarUsuario(){
            if($('#textRepetirSenha').val() == $('#textSenha').val())
            {
                $.ajax({
                    type: "POST",
                    url: "NovoAcesso.aspx/cadastrarUsuario",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify({nome: $('#textNome').val(), 
                        login: $('#textLogin').val(),
                        sexo: $('#textSexo').val(),
                        senha: $('#textSenha').val(),
                        email: $('#textEmail').val()}),
                    success: 
                        function (msg) {
                            if(msg.d == true)
                            {
                                $.growlUI('Cadastrado com sucesso !');
						        window.location = "Login.aspx";
                            }
                            else
                                $.growlUI('Usuário ja existe !');                               
                               
                        },
                });
            }
            else
                alert('Repita a senha corretamente!');
        }
    }
    else
        $.growlUI('Preencha todos os campos !');
    </script>
    <style type="text/css">
        div.growlUI h1, div.growlUI h2 {
	        color: white; padding: 2px 2px 2px 50px; text-align: left
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderConteudo" Runat="Server">
 <asp:Label ID="LabelNovoAcesso" Text="Cadastre-se no Sistema de Eventos" Font-Size="20px" Font-Bold="true" runat="server"></asp:Label><br />
    <br />            
    <table>    
        <tr>
            <td style="width: 45%">
                Nome:
            </td>
            <td style="width: 80%">
                <input id="textNome" type="text" />              
            </td>
        </tr>
         <tr>
            <td style="width: 45%">
                Login:
            </td>
            <td style="width: 45%">
                <input id="textLogin" type="text" />
            </td>
        </tr>
          <tr>
            <td style="width: 45%">
                Sexo:
            </td>
            <td style="width: 80%">              

            <select id="textSexo">
                <option>Masculino</option>
                <option>Feminino</option>
            </select>

            </td>
        </tr>
        <tr>
            <td style="width: 45%">
                Email:
            </td>
            <td style="width: 80%">
                <input id="textEmail" type="text" />
            </td>
        </tr>
        <tr>
            <td style="width: 45%">
                Senha:
            </td>
            <td style="width: 80%">
                <input id="textSenha" type="password" />
            </td>
        </tr>
        <tr>
            <td style="width: 45%">
                Repetir Senha:
            </td>
            <td style="width: 80%">
                <input id="textRepetirSenha" type="password" />
            </td>
        </tr>

     </table>
    <br />
    <a class="buttonAcao" href="javascript:window.location='Default.aspx';">Voltar</a>
    <a class="buttonAcao" href="javascript:cadastrarUsuario()">Enviar</a>
    <br />
    <br />
 
</asp:Content>

